import { LoginData } from "./types"
import { request } from '@/utils/request'
import Qs from "qs";

export const apiLogin = (data: LoginData) => {
  return request({
    url: '/auth/login',
    method: 'post',
    headers: {
      isToken: false,
      isEncrypt: true
    },
    data
  })
}

export const apiLogout = () => {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}
/** 注销 */
export const cancel = (data) => {
  return request({
    url: '/system/user/cancel',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}

// 隐私政策
export const listNotice = (data: any) => {
  return request({
    url: "/system/notice/list",
    method: "get",
    params: data,
  });
}
/** 注册发送验证码 */
export const registerCode = (data) => {
  return request({
    url: '/system/registerCode',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}
/** 注册对外身份 */
export const register = (data) => {
  return request({
    url: '/system/register',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}

/** 找回密码发送手机验证码 */
export const findPasswordCode = (data) => {
  return request({
    url: '/system/findPasswordCode',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}
/** 找回密码手机验证码验证 */
export const findPasswordCheckCode = (data) => {
  return request({
    url: '/system/findPasswordCheckCode',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}
/** 手机号找回密码 */
export const resetUserPwd = (data) => {
  return request({
    url: '/system/resetUserPwd',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}
/** 修改密码 */
export const updatePassword = (data) => {
  return request({
    url: '/system/updatePassword',
    method: 'post',
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  })
}

